<%@ page import="com.luojiaoj.news.News" %>
<!doctype html>
<html>
<head>
    <meta name="layout" content="OJMain">
    <title><g:message code="ljoj.onlinejudge.news.create.title" /></title>
</head>

<body>

<div id="create-news" class="content scaffold-create" role="main">
    <h1><g:message code="default.create.label"/></h1>
    <g:if test="${flash.message}">
        <div class="message" role="status">${flash.message}</div>
    </g:if>
    <g:hasErrors bean="${newsInstance}">
        <ul class="errors" role="alert">
            <g:eachError bean="${newsInstance}" var="error">
                <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>><g:message
                        error="${error}"/></li>
            </g:eachError>
        </ul>
    </g:hasErrors>
    <g:form action="save">
        <fieldset class="form">
            <div class="fieldcontain ${hasErrors(bean: newsInstance, field: 'title', 'error')} ">
                <label for="title">
                    <g:message code="ljoj.onlinejudge.news.title.label" default="Title"/>

                </label>
                <g:textField name="title" maxlength="32" value="${newsInstance?.title}"/>
            </div>

            <div class="fieldcontain ${hasErrors(bean: newsInstance, field: 'content', 'error')} ">
                <label for="content">
                    <g:message code="ljoj.onlinejudge.news.content.label" default="Content"/>
                </label>
                <g:textArea name="content" cols="40" rows="5" maxlength="65535" value="${newsInstance?.content}"/>
            </div>

            <div class="fieldcontain ${hasErrors(bean: newsInstance, field: 'create', 'error')} required">
                %{--<label for="create">--}%
                    %{--<g:message code="ljoj.onlinejudge.news.creator.label" default="Create"/>--}%
                    %{--<span class="required-indicator">*</span>--}%
                %{--</label>--}%
                <input name="creator.id" type="hidden" value="${curUserId}" />
            </div>
        </fieldset>
        <fieldset class="buttons">
            <g:submitButton name="create" class="save"
                            value="${message(code: 'default.button.create.label', default: 'Create')}"/>
        </fieldset>
    </g:form>
</div>
</body>
</html>
